#ifndef UITEXTENTRY_H_
#define UITEXTENTRY_H_

#include "UIElement.h"
#include "KeyboardEvent.h"

namespace Lame3d
{
	class UITextEntry : public UIElement
	{
		public:
			UITextEntry(const std::string &n, const Point2d &l, const Point2d &s);
			~UITextEntry();
			
			const std::string& Text() const;
			void Text(const std::string& t);
			
			const std::string& TextWithCursor();
			
			void Clear();
			
			void Insert(char c);
			void Backspace();
			void Delete();
			void Left();
			void Right();
			void Home();
			void End();
			
			bool HasFocus() const;
			void HasFocus(bool b);
			
			void Handle(const KeyEvent &e);
			
			const std::string& EnterMessage() const;
			void EnterMessage(const std::string &s);
			
			int CursorIndex() const;
			
		protected:
			std::string text;
			std::string textWithCursor;
			bool hasFocus;
			bool isProtected;
			unsigned int cursorIdx;
			
			std::string enterMessage;
	};
}

#endif /*UITEXTENTRY_H_*/
